package com.log.blog_backend.controller;


import com.log.blog_backend.common.Result;
import com.log.blog_backend.entity.ArticleComments;
import com.log.blog_backend.service.ArticleCommentsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;



@RestController
@RequestMapping("/articlecomment")
@CrossOrigin
@Slf4j
public class ArticleCommentsController {

    @Autowired
    ArticleCommentsService articleCommentsService;

    @PostMapping("/comment")
    public Result comment(@RequestBody ArticleComments articleComments,HttpServletRequest httpServletRequest){
        log.info(">>>>>>"+articleComments);
        return  articleCommentsService.comment(articleComments,httpServletRequest);
    }
    @PostMapping("/getcomment")
    public Result getcomment(@RequestBody String articleId){
        return  articleCommentsService.getcomment(articleId);
    }
    @PostMapping("/getcommentCount")
    public Result getcommentCount(@RequestBody String articleId){
        return  articleCommentsService.getcommentCount(articleId);
    }


}

